{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "main.cpp\n",
      "mainwindow.cpp\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "path='/home/zhongy/test'\n",
    "fName=os.listdir(path)\n",
    "for i in fName:\n",
    "    if os.path.splitext(i)[1]=='.cpp':\n",
    "        print(i)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "使用os库来操作；在ubuntu系统下，路径名需要注意：应该在home下的用户名下找，不能直接在Home下去找，否则会出现路径名错误"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
